import React, { Component } from 'react';
import {
  AppRegistry,
  StyleSheet,
  Text,
  View,
  TouchableOpacity,
  Platform,
  ScrollView
} from 'react-native';

import { AutoGrowingTextInput } from 'react-native-autogrow-textinput';
import { public_Style as styles } from '../../styles';
var Dimensions = require('Dimensions');
var width = Dimensions.get('window').width;
var height = Dimensions.get('window').height;

export default class Autoinput3 extends Component {
  constructor(props) {
    super(props);
    this.state = { textValue: 'My initial\nText' };
  }

  render() {
    return (
      // <View style={[styles.allinput2, { flex: 1 }]}>
        <AutoGrowingTextInput
          style={styles.textInput3}
          underlineColorAndroid="transparent"
          defaultValue={this.props.text}
          onChangeText={this.text.bind(this)}
          onFocus={this.props.onFocus}
          onChange={this.props.onChange}
        />
      // </View>
    );
  }

  text(a) {
    this.props.function(a);
  }

  _onChange(event) {
    this.setState({ textValue: event.nativeEvent.text || '' });
  }

  _resetTextInput() {
    this._textInput.clear();
    this._textInput.resetHeightToMin();
  }
}

const IsIOS = Platform.OS === 'ios';